# 变量不存在 => NameError
# print(abc)

# 除数不能是0 => ZeroDivisionError
# print(10 / 0)

arr = [1, 2, 3, 5]
# 索引超出范围 => IndexError
# print(arr[4])  # 正向索引范围：0 ~ 3
# print(arr[-5])  # 反向索引的范围：-4 ~ -1

class User:
    def __init__(self, name, age):
        self.name = name
        self.age = age

user = User('张三', 20)
# 属性不存 => AttributeError
# print(user.sex)
# 方法不存在 => AttributeError
# user.eat()

# 只读模式文件不存在 => FileNotFoundError
# file = open('a.txt')